<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* * *********************************
 * UniPortal - Login module
* @Author: Le Thuy Trieu
* @date: 2011/12/28
* ******************************** */
class Users extends MY_Controller {

	var $secure = 1;

	function __construct() {
		parent::__construct();

		$this->template->set_template('login');
		parent::add_jQueryMobile_css();
		parent::add_jQueryMobile_js();
	}

	public function index($email = '', $password = '' )
	{

		if(!$this->_is_connect()){
			redirect(site_url('login'), 'refresh');
			return TRUE;
		}else{
			$data['email'] = $this->session->userdata('email');
			$this->template->parse_view("content", "view_users", $data);
			$this->template->render();
		}

	}

	public function signup() {
		$row = $this->db->_find_by_key(array('email' => $data['email']));
		if (empty($row)) {
			return $this->_insert($data);
		}
	}



	public function logout(){
		$this->session->unset_userdata('email');
		redirect(site_url('login'),'location');
	}
}
